namespace go admin_product_category
include "error_code.thrift"

struct Category {
    1: i64 ID(api.body="id")
    2: string Name(api.body="name")
    3: i64 PID (api.body="pid")
    4: list<Category> Children(api.body='children')
    5: i64 Sort(api.body='sort')
    6: string Label(api.body='label')
}

struct SelectCategory {
    1: i64 ID(api.body="id")
    2: i64 Disabled(api.body="disabled")
    3: string Label(api.body="label")
}

struct CreateCategoryRequest {
    1: string Name (api.body='name')
    2: i64 PID (api.body='pid')
    3: i64 Sort (api.body='sort')
}

struct CreateCategoryResponse {
    1: error_code.ErrorCode Code (api.body='code')
}

struct GetCategoryListRequest {
    1: i64 Page = 1 (api.query="page");
    2: i64 Size = 20 (api.query="size");
    3: string Name (api.body='name')
}

struct GetCategoryListResponse {
    1: error_code.ErrorCode Code (api.body='code')
    2: list<Category> Data (api.body='data')
    3: i64 Page (api.body='page')
    4: i64 Size (api.body='size')
}

struct GetSelectCategoryListRequest {
}

struct GetSelectCategoryListResponse {
    1: error_code.ErrorCode Code (api.body='code')
    2: list<SelectCategory> Data (api.body='data')
}

struct DeleteCategoryRequest {
    1: list<i64> IDs (api.body="ids")
}

struct DeleteCategoryResponse {
    1: error_code.ErrorCode Code (api.body='code')
}

struct UpdateCategoryRequest {
    1: i64 ID (api.query="id")
    2: optional string Name (api.body='name')
    3: optional i64 PID (api.body='pid')
    4: optional i64 Sort (api.body='sort')
}

struct UpdateCategoryResponse {
    1: error_code.ErrorCode Code (api.body='code')
}


struct GetCategoryInfoRequest {
    1: i64 ID (api.body="id")
}

struct GetCategoryInfoResponse {
    1: error_code.ErrorCode Code (api.body='code')
    2: Category Data (api.body='data')
}